<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>把字符串当作数组使用</title>
</head>
<body>
    <script>
        // String 对象有一个length属性，表示字符串中字符的数量
        var str = '123456789';

        for(var i = 0;i<str.length;i++){
            document.write(str[i],'<br>');
        }
    </script>
</body>
</html>